package com.startup.yellocar.dto;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Id;

@Entity
@Table(name = "usertravel")
public class UserTravelDTO {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "iduser")
	private UserDTO user;
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "idjourney")
	private JourneyDTO journey;
	
	@Column(name = "travelcode")
	private String travelCode;
	
	@Column(name="role") 
	@Enumerated(EnumType.STRING)
	private TravelRoleEnum role;
	
	@Column(name = "effectivedate")
	private Date effectiveDate;
	
	@Column(name = "approved")
	private boolean approved;
	
	@Column(name = "datecreate", updatable = false, insertable = false)
	private Date dateCreate;

	
	
	public UserTravelDTO() {
		super();
		// TODO Auto-generated constructor stub
	}

	public UserTravelDTO(Integer id, String travelCode, TravelRoleEnum role,
			Date effectiveDate, boolean approved) {
		super();
		this.id = id;
		this.travelCode = travelCode;
		this.role = role;
		this.effectiveDate = effectiveDate;
		this.approved = approved;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public UserDTO getUser() {
		return user;
	}

	public void setUser(UserDTO user) {
		this.user = user;
	}

	public JourneyDTO getJourney() {
		return journey;
	}

	public void setJourney(JourneyDTO journey) {
		this.journey = journey;
	}

	public String getTravelCode() {
		return travelCode;
	}

	public void setTravelCode(String travelCode) {
		this.travelCode = travelCode;
	}

	public TravelRoleEnum getRole() {
		return role;
	}

	public void setRole(TravelRoleEnum role) {
		this.role = role;
	}

	public Date getEffectiveDate() {
		return effectiveDate;
	}

	public void setEffectiveDate(Date effectiveDate) {
		this.effectiveDate = effectiveDate;
	}

	public boolean isApproved() {
		return approved;
	}

	public void setApproved(boolean approved) {
		this.approved = approved;
	}

	public Date getDateCreate() {
		return dateCreate;
	}

	public void setDateCreate(Date dateCreate) {
		this.dateCreate = dateCreate;
	}

	
	
	


}
